﻿using System;
using System.Collections.Generic;
using System.Linq.Expressions;
using System.Linq;
using System.Threading.Tasks;
using Microsoft.EntityFrameworkCore;

namespace JoyfulHomeJourney.BackEnd.Repository.Interfaces
{
    public interface IRepository<T> where T : class, new()
    {
        DbSet<T> TSet();
        IQueryable<T> Query();
        IQueryable<T> Query(Expression<Func<T, bool>> where);
        IQueryable<T> Query<TKey>(Expression<Func<T, bool>> where, bool isAsc, Expression<Func<T, TKey>> order);
        IQueryable<T> Pagination1<TKey>(Expression<Func<T, bool>> where, bool isAsc, Expression<Func<T, TKey>> order, out int total, int page, int limit);
        Task<int> AddAsync(T t);
        Task<int> AddAsync(IEnumerable<T> ie);
        Task<int> UpdateAllProperAsync(T t);
        Task<int> UpdateAllProperAsync(IEnumerable<T> t);
        Task<int> UpdateAllProperNotNullAsync(T t);
        Task<int> UpdateAllProperNotNullAsync(IEnumerable<T> ie);
        Task<int> DeleteAsync(T t);
        Task<int> DeleteAsync(IEnumerable<T> ie);
        Task<int> SaveAsync();
        int Add(T t);
        int Add(IEnumerable<T> ie);
        int UpdateAllProper(T t);
        int UpdateAllProper(IEnumerable<T> t);
        int UpdateAllProperNotNull(T t);
        int UpdateAllProperNotNull(IEnumerable<T> ie);
        int Delete(T t);
        int Delete(IEnumerable<T> ie);
        int Save();
    }
}
